function xuanqupaixu (n) {
  let arr = []
  for (let i = 0; i < 1000; i++) {
    let randomNum = Math.round(Math.random() * 30)
    arr.push(randomNum)
  }
  // for (let i = 0; i < arr.length - 1; i++) {
  //   for (let j = 0; j < arr.length - 1 - i; j++) {
  //     if (arr[j] > arr[j + 1]) {
  //       [arr[j], arr[j + 1]] = [arr[j + 1], arr[j]]
  //     }
  //   }
  // }
  // return arr
  let map = {}
  for (let i = 0; i < arr.length; i++) {
    if (!map[arr[i]]) {
      map[arr[i]] = 0
    }
    map[arr[i]]++
  }
  for (let key of Object.keys(map)) {
    map[key] = map[key] / 1000
  }
  console.log(map);
}
console.log(xuanqupaixu(10));